********* Table A10 *********
clear all
set more off 
capture log close
 
* main path to data
global path "~/Dropbox/Paraguay/1_data/7_replication_dataverse"
capture cd "$path"	

*tables = analysis tables
global tables "$path/tables"


* main panel
use "$path/data/main.dta", clear

xtset id year


// Generate indicator variables for years 1954 to 2007
forval year = 1954/2007 {
    generate y`year' = (year == `year')
}

// Generate the alt_1989 variable and set it to 0
generate alt_1989 = 0



set more off
reghdfe tmh_ha_log zdegree ///			
			y1954#c.zdegree y1955#c.zdegree ///
			y1956#c.zdegree y1957#c.zdegree y1958#c.zdegree y1959#c.zdegree y1960#c.zdegree ///
			y1961#c.zdegree y1962#c.zdegree y1963#c.zdegree y1964#c.zdegree y1965#c.zdegree ///
			y1966#c.zdegree y1967#c.zdegree y1968#c.zdegree y1969#c.zdegree y1970#c.zdegree ///
			y1971#c.zdegree y1972#c.zdegree y1973#c.zdegree y1974#c.zdegree y1975#c.zdegree ///
			y1976#c.zdegree y1977#c.zdegree y1978#c.zdegree y1979#c.zdegree y1980#c.zdegree ///
			y1981#c.zdegree y1982#c.zdegree y1983#c.zdegree y1984#c.zdegree y1985#c.zdegree ///
			y1986#c.zdegree y1987#c.zdegree y1988#c.zdegree ///
			alt_1989 ///
			y1990#c.zdegree y1991#c.zdegree y1992#c.zdegree y1993#c.zdegree y1994#c.zdegree ///
			y1995#c.zdegree y1996#c.zdegree y1997#c.zdegree y1998#c.zdegree y1999#c.zdegree ///
			y2000#c.zdegree y2001#c.zdegree y2002#c.zdegree  y2003#c.zdegree y2004#c.zdegree ///
			 y2005#c.zdegree y2006#c.zdegree y2007#c.zdegree ///
			[pweight=p_weights] if sample_weight == 1, absorb(year id) cluster(id) nocons

eststo		


set more off
reghdfe tmh_e zdegree ///
			y1954#c.zdegree y1955#c.zdegree ///
			y1956#c.zdegree y1957#c.zdegree y1958#c.zdegree y1959#c.zdegree y1960#c.zdegree ///
			y1961#c.zdegree y1962#c.zdegree y1963#c.zdegree y1964#c.zdegree y1965#c.zdegree ///
			y1966#c.zdegree y1967#c.zdegree y1968#c.zdegree y1969#c.zdegree y1970#c.zdegree ///
			y1971#c.zdegree y1972#c.zdegree y1973#c.zdegree y1974#c.zdegree y1975#c.zdegree ///
			y1976#c.zdegree y1977#c.zdegree y1978#c.zdegree y1979#c.zdegree y1980#c.zdegree ///
			y1981#c.zdegree y1982#c.zdegree y1983#c.zdegree y1984#c.zdegree y1985#c.zdegree ///
			y1986#c.zdegree y1987#c.zdegree y1988#c.zdegree ///
			alt_1989 ///
			y1990#c.zdegree y1991#c.zdegree y1992#c.zdegree y1993#c.zdegree y1994#c.zdegree ///
			y1995#c.zdegree y1996#c.zdegree y1997#c.zdegree y1998#c.zdegree y1999#c.zdegree ///
			y2000#c.zdegree y2001#c.zdegree y2002#c.zdegree  y2003#c.zdegree y2004#c.zdegree ///
			 y2005#c.zdegree y2006#c.zdegree y2007#c.zdegree ///
			[pweight=p_weights] if sample_weight == 1, absorb(year id) cluster(id) nocons
			
	eststo		
			
capture cd "$tables"
esttab est* using "tableA10.tex", replace nonumber label style(tex) ///
    cells(b(star fmt(%12.4fc)) se(par fmt(%12.4fc))) ///
    stats( N r2 , fmt( %12.0fc %12.4fc ) ///
        label("\hline Observations"  ///
          "\$R^2\$" )) ///
    keep( 1.y1971#c.zdegree 1.y1972#c.zdegree 1.y1973#c.zdegree 1.y1974#c.zdegree 1.y1975#c.zdegree ///
    1.y1976#c.zdegree 1.y1977#c.zdegree 1.y1978#c.zdegree 1.y1979#c.zdegree 1.y1980#c.zdegree ///
    1.y1981#c.zdegree 1.y1982#c.zdegree 1.y1983#c.zdegree 1.y1984#c.zdegree 1.y1985#c.zdegree ///
    1.y1986#c.zdegree 1.y1987#c.zdegree 1.y1988#c.zdegree 1.y1990#c.zdegree 1.y1991#c.zdegree ///
    1.y1992#c.zdegree 1.y1993#c.zdegree 1.y1994#c.zdegree 1.y1995#c.zdegree 1.y1996#c.zdegree ///
    1.y1997#c.zdegree 1.y1998#c.zdegree 1.y1999#c.zdegree 1.y2000#c.zdegree 1.y2001#c.zdegree ///
    1.y2002#c.zdegree 1.y2003#c.zdegree 1.y2004#c.zdegree 1.y2005#c.zdegree 1.y2006#c.zdegree ///
    1.y2007#c.zdegree) ///    
    order(1.y1971#c.zdegree 1.y1972#c.zdegree 1.y1973#c.zdegree 1.y1974#c.zdegree 1.y1975#c.zdegree ///
    1.y1976#c.zdegree 1.y1977#c.zdegree 1.y1978#c.zdegree 1.y1979#c.zdegree 1.y1980#c.zdegree ///
    1.y1981#c.zdegree 1.y1982#c.zdegree 1.y1983#c.zdegree 1.y1984#c.zdegree 1.y1985#c.zdegree ///
    1.y1986#c.zdegree 1.y1987#c.zdegree 1.y1988#c.zdegree 1.y1990#c.zdegree 1.y1991#c.zdegree ///
    1.y1992#c.zdegree 1.y1993#c.zdegree 1.y1994#c.zdegree 1.y1995#c.zdegree 1.y1996#c.zdegree ///
    1.y1997#c.zdegree 1.y1998#c.zdegree 1.y1999#c.zdegree 1.y2000#c.zdegree 1.y2001#c.zdegree ///
    1.y2002#c.zdegree 1.y2003#c.zdegree 1.y2004#c.zdegree 1.y2005#c.zdegree 1.y2006#c.zdegree ///
    1.y2007#c.zdegree ) ///
    varlabels(1.y1971#c.zdegree "Year 1971 \$\times\$ Degree" 1.y1972#c.zdegree "Year 1972 \$\times\$ Degree" ///
    1.y1973#c.zdegree "Year 1973 \$\times\$ Degree" 1.y1974#c.zdegree "Year 1974 \$\times\$ Degree" ///
    1.y1975#c.zdegree "Year 1975 \$\times\$ Degree" 1.y1976#c.zdegree "Year 1976 \$\times\$ Degree" ///
    1.y1977#c.zdegree "Year 1977 \$\times\$ Degree" 1.y1978#c.zdegree "Year 1978 \$\times\$ Degree" ///
    1.y1979#c.zdegree "Year 1979 \$\times\$ Degree" 1.y1980#c.zdegree "Year 1980 \$\times\$ Degree" ///
    1.y1981#c.zdegree "Year 1981 \$\times\$ Degree" 1.y1982#c.zdegree "Year 1982 \$\times\$ Degree" ///
    1.y1983#c.zdegree "Year 1983 \$\times\$ Degree" 1.y1984#c.zdegree "Year 1984 \$\times\$ Degree" ///
    1.y1985#c.zdegree "Year 1985 \$\times\$ Degree" 1.y1986#c.zdegree "Year 1986 \$\times\$ Degree" ///
    1.y1987#c.zdegree "Year 1987 \$\times\$ Degree" 1.y1988#c.zdegree "Year 1988 \$\times\$ Degree" ///
    1.y1990#c.zdegree "Year 1990 \$\times\$ Degree" 1.y1991#c.zdegree "Year 1991 \$\times\$ Degree" ///
    1.y1992#c.zdegree "Year 1992 \$\times\$ Degree" 1.y1993#c.zdegree "Year 1993 \$\times\$ Degree" ///
    1.y1994#c.zdegree "Year 1994 \$\times\$ Degree" 1.y1995#c.zdegree "Year 1995 \$\times\$ Degree" ///
    1.y1996#c.zdegree "Year 1996 \$\times\$ Degree" 1.y1997#c.zdegree "Year 1997 \$\times\$ Degree" ///
    1.y1998#c.zdegree "Year 1998 \$\times\$ Degree" 1.y1999#c.zdegree "Year 1999 \$\times\$ Degree" ///
    1.y2000#c.zdegree "Year 2000 \$\times\$ Degree" 1.y2001#c.zdegree "Year 2001 \$\times\$ Degree" ///
    1.y2002#c.zdegree "Year 2002 \$\times\$ Degree" 1.y2003#c.zdegree "Year 2003 \$\times\$ Degree" ///
    1.y2004#c.zdegree "Year 2004 \$\times\$ Degree" 1.y2005#c.zdegree "Year 2005 \$\times\$ Degree" ///
    1.y2006#c.zdegree "Year 2006 \$\times\$ Degree" 1.y2007#c.zdegree "Year 2007 \$\times\$ Degree") ///    
    collabels(, none) eqlabels(, none) starlevels(* 0.1 ** 0.05 *** 0.01) ///
    prehead(\begin{tabular}{l*{@M}{c}} \hline ///
        &  \multicolumn{1}{c}{Hectares (log)}  & \multicolumn{1}{c}{Land grant (binary)}  \\ ///
        & (1) & (2)   \\)  ///
    posthead(\hline ) mlabels(, none) ///
    prefoot( ) postfoot(\hline \end{tabular})
